<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>tagiterator.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">tagiterator.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    <span class='nodesc'>No description.</span>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_dom_tagiterator.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/dom/tagiterator.js">Git</a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">/goog/dom/tagiterator.js</div>
    </div>
  </div>
<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="class_goog_dom_TagIterator.html">
          goog.dom.TagIterator</a><br/>
        <div class="class-details">A DOM tree traversal iterator.

Starting with the given node, the iterator walks the DOM in order, reporting
events for the start and end of Elements, and the presence of text nodes. For
example:

<pre class="lang-js prettyprint">
&lt;div&gt;1&lt;span&gt;2&lt;/span&gt;3&lt;/div&gt;
</pre>

Will return the following nodes:

<code>[div, 1, span, 2, span, 3, div]</code>

With the following states:

<code>[START, OTHER, START, OTHER, END, OTHER, END]</code>

And the following depths

<code>[1, 1, 2, 2, 1, 1, 0]</code>

Imagining <code>|</code> represents iterator position, the traversal stops at
each of the following locations:

<pre class="lang-js prettyprint">
&lt;div&gt;|1|&lt;span&gt;|2|&lt;/span&gt;|3|&lt;/div&gt;|
</pre>

The iterator can also be used in reverse mode, which will return the nodes
and states in the opposite order.  The depths will be slightly different
since, like in normal mode, the depth is computed *after* the given node.

Lastly, it is possible to create an iterator that is unconstrained, meaning
that it will continue iterating until the end of the document instead of
until exiting the start node.

</div>
 </div>
      



<h2>Enumerations</h2>






<div class="section">
  <table class="horiz-rule">


  </table>
</div>










      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory dom</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="" current="/goog/dom/tagiterator.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
